import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './vuex/store'
import './registerServiceWorker'
//初始化所有样式
import 'reset-css';
//导入style.css文件
import "@/assets/css/style.css"
//导入element-ui
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
Vue.use(ElementUI);
//引入mixin文件
import '@/mixins/mixins'
//引用font-awsome
import '@/assets/css/font-awesome.css'

import "@/utils/axios"
import '@/apis'  //apis文件夹下有index.js,默认直接找index.js
Vue.config.productionTip = false

//配置路由守卫
router.beforeEach((to,from,next)=>{
	if(to.path==='/Signin'){
		localStorage.clear();
		next();
	}else{
		if(localStorage.getItem("token")){
			next();
		}else{
			next({
				path:'/Signin',query:{redirect:to.path}
			})
		}
	}
})
new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
